<include file="public@mobileHeader"/>
<section class="ui-container homework">
    <h1 class="ui-row ">
        <span>
            <a class="" href="/mobile/homework/add">
                布置作业
            </a>
        </span>
    </h1>
    <foreach name="data" item="vo">
        <table class="ui-table ui-border-tb">
            <tbody>
            <tr>
                <th>班级:</th>
                <td>{$vo.cname}</td>
            </tr>
            <tr>
                <th>授课老师:</th>
                <td>{$vo.user_login}</td>
            </tr>
            <tr>
                <th>课次:</th>
                <td>{$vo.progress}</td>
            </tr>
            <tr>
                <th>上课进度:</th>
                <td>{$vo.lesson_theme}</td>
            </tr>
            <tr>
                <th>作业内容:</th>
                <td>{$vo.content}</td>
            </tr>
            <tr>
                <th>时间:</th>
                <td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
            </tr>
            <tr>
                <th>操作:</th>
                <td class="ui-btn-wrap">
                    <a href="{:url('Homework/edit',array('id'=>$vo.id))}" class="ui-btn-s ui-btn-primary editBtn"
                       attr_id="{$vo.id}">
                        编辑
                    </a>
                    |
                    <a data-url="{:url('Homework/delete',array('id'=>$vo.id))}"
                            class="ui-btn-s ui-btn-danger deleteBtn">
                        删除
                    </a>
                </td>
            </tr>
            </tbody>
        </table>
    </foreach>

    <div class="pagination">{$page}</div>

</section>
<include file="public@mobileFooter"/>
<script type="text/javascript">
    $(".deleteBtn").tap(function () {
        var dia = $.dialog({
            title: '提示',
            content: '确认要删除吗？',
            button: ["确认", "取消"],
        });

        var url = $(this).data("url");
        dia.on("dialog:action", function (e) {
            if (e.index == 0) {
                dia.hide();
                var el = $.loading({
                    content: '加载中...',
                });
                $.post(url, function (data) {
                    if (data.code == 1) {
                        el.loading("hide");
                        el = $.tips({
                            content: '删除成功',
                            stayTime: 2000,
                            type: "success"
                        });
                        el.on("tips:hide",function(){
                            window.location.reload();
                        })

                    }
                });
            }

        });
    })
</script>